home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / dev / lang / Python16_Src.lha / Python16_Source / Include / pystate.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-08-03  |  1.8 KB  |  88 lines

  1. #ifndef Py_PYSTATE_H
  2. #define Py_PYSTATE_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6.  
  7. /* Thread and interpreter state structures and their interfaces */
  8.  
  9.  
  10. /* State shared between threads */
  11.  
  12. struct _ts; /* Forward */
  13. struct _is; /* Forward */
  14.  
  15. typedef struct _is {
  16.  
  17.     struct _is *next;
  18.     struct _ts *tstate_head;
  19.  
  20.     PyObject *modules;
  21.     PyObject *sysdict;
  22.     PyObject *builtins;
  23.  
  24.     int checkinterval;
  25.  
  26. } PyInterpreterState;
  27.  
  28.  
  29. /* State unique per thread */
  30.  
  31. struct _frame; /* Avoid including frameobject.h */
  32.  
  33. typedef struct _ts {
  34.  
  35.     struct _ts *next;
  36.     PyInterpreterState *interp;
  37.  
  38.     struct _frame *frame;
  39.     int recursion_depth;
  40.     int ticker;
  41.     int tracing;
  42.  
  43.     PyObject *sys_profilefunc;
  44.     PyObject *sys_tracefunc;
  45.  
  46.     PyObject *curexc_type;
  47.     PyObject *curexc_value;
  48.     PyObject *curexc_traceback;
  49.  
  50.     PyObject *exc_type;
  51.     PyObject *exc_value;
  52.     PyObject *exc_traceback;
  53.  
  54.     PyObject *dict;
  55.  
  56.     /* XXX signal handlers should also be here */
  57.  
  58. } PyThreadState;
  59.  
  60.  
  61. DL_IMPORT(PyInterpreterState *) PyInterpreterState_New Py_PROTO((void));
  62. DL_IMPORT(void) PyInterpreterState_Clear Py_PROTO((PyInterpreterState *));
  63. DL_IMPORT(void) PyInterpreterState_Delete Py_PROTO((PyInterpreterState *));
  64.  
  65. DL_IMPORT(PyThreadState *) PyThreadState_New Py_PROTO((PyInterpreterState *));
  66. DL_IMPORT(void) PyThreadState_Clear Py_PROTO((PyThreadState *));
  67. DL_IMPORT(void) PyThreadState_Delete Py_PROTO((PyThreadState *));
  68.  
  69. DL_IMPORT(PyThreadState *) PyThreadState_Get Py_PROTO((void));
  70. DL_IMPORT(PyThreadState *) PyThreadState_Swap Py_PROTO((PyThreadState *));
  71. DL_IMPORT(PyObject *) PyThreadState_GetDict Py_PROTO((void));
  72.  
  73.  
  74. /* Variable and macro for in-line access to current thread state */
  75.  
  76. extern DL_IMPORT(PyThreadState *) _PyThreadState_Current;
  77.  
  78. #ifdef Py_DEBUG
  79. #define PyThreadState_GET() PyThreadState_Get()
  80. #else
  81. #define PyThreadState_GET() (_PyThreadState_Current)
  82. #endif
  83.  
  84. #ifdef __cplusplus
  85. }
  86. #endif
  87. #endif /* !Py_PYSTATE_H */
  88.